
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:at_auth_plugin/at_auth_plugin.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String result = '未知';

  @override
  void initState() {
    super.initState();
    initPlugin();
  }

  Future<void> initPlugin() async {
    try {
      final version = await AtAuthPlugin.getVersion();
      log(version);
      setState(() {
        result = version;
      });
    } catch (e) {
      result = '发生错误: $e';
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('ATAuth 插件示例')),
        body: Center(child: Text('平台版本: $result')),
      ),
    );
  }
}
